<template>
  <div class="select_good_wrap">
    <div class="search_box">
      <van-search
        v-model="lendGoodStore.selectGoodSearchKeyword"
        show-action
        placeholder="请输入货品关键词"
        @cancel="cancelClick"
      />
    </div>

    <!-- 占位盒子 -->
    <div class="placeholder_box"></div>
    <!-- <div class="select_goods_box">
      <div class="good_item_box" v-for="(good, indexG) in lendGoodStore.showSelectGoods" :key="indexG">
        {{ good.name }}
      </div>
    </div> -->
    <van-list v-model:loading="lendGoodStore.isGoodListLoading" :disabled="true">
      <van-cell
        v-for="(good, indexG) in lendGoodStore.showSelectGoods"
        :key="indexG"
        :title="good.name"
        @click="lendGoodStore.selectGoodClick(good)"
      />
    </van-list>
  </div>
</template>

<script>
import { defineComponent, onMounted } from "vue";
// import { showToast } from "vant";
import "./index.scss";
export default defineComponent({
  name: "SelectGood"
});
</script>
<script setup>
import { useLendGoodStore } from "@/stores/modules/lendGood";
import { useRouter } from "vue-router";

// router
const router = useRouter();

const lendGoodStore = useLendGoodStore();

// // 选择货品点击事件
// const selectGoodClick = good => {};

// 取消点击事件
const cancelClick = () => {
  router.back();
  lendGoodStore.selectGoodSearchKeyword = "";
  lendGoodStore.currentSelectGoodGId = null;
};

onMounted(() => {
  if (lendGoodStore.allGoods.length == 0) {
    lendGoodStore.selectTbGoodsByPageFunc();
  }
});
</script>

<style lang="scss" scoped></style>
